local scheduler = import("framework.scheduler")
local ShaYu =class("ShaYu",function () return display.newNode() end)
function ShaYu:ctor()
 self.ShaYu = display.newSprite("#shayu0001.png",0,0);
 local ShaYuFrames =display.newFrames("shayu00%02d.png",1,8)
 local animation =display.newAnimation(ShaYuFrames, 1.0 / 8) 
 transition.playAnimationForever(self.ShaYu,animation)
-- display.setAnimationCache("ShaYuAni",animation)
 self:addChild(self.ShaYu) 
  
end
function ShaYu:checkColliWithFish(fishRect)
   if not self:getParent() or not self:getParent():getParent() then return false end
     local layerX,layerY =self:getParent():getParent():getPosition()
     local uiX,uiY =self:getParent():getPosition()
     local x ,y =self:getPosition()
     local size =self.ShaYu:getContentSize()
     local width =size.width -80
     local height =size.height-80
     local coinRect =CCRect(layerX+uiX+x-width/2,layerY+uiY+y-height/2,width,height)
     if fishRect:intersectsRect(coinRect) then
            return true
     end
    return false

end

return ShaYu
